package main

import "fmt"

type Pay interface {
	Pay(money int64)
}

type AliPay struct {
}

func (a *AliPay) Pay(money int64) {
	fmt.Printf("支付宝支付%d元\n", money)
}

type WechatPay struct {
}

func (w *WechatPay) Pay(money int64) {
	fmt.Printf("微信支付%d元\n", money)
}

type PayStrategy struct {
	pay Pay
}

func (p *PayStrategy) SetPay(pay Pay) {
	p.pay = pay
}

func (p *PayStrategy) Pay(money int64) {
	p.pay.Pay(money)
}

func main() {
	pay := &PayStrategy{}
	pay.SetPay(&AliPay{})
	pay.Pay(100)
	pay.SetPay(&WechatPay{})
	pay.Pay(200)
}
